<template>
    <lightning-card title="ApexImperativeMethod" icon-name="custom:custom63">
        <div class="slds-var-m-around_medium">
            <p class="slds-var-m-bottom_small">
                <lightning-button
                    label="Load Contacts"
                    onclick={handleLoad}
                ></lightning-button>
            </p>
            <template lwc:if={contacts}>
                <template for:each={contacts} for:item="contact">
                    <p key={contact.Id}>{contact.Name}</p>
                </template>
            </template>
            <template lwc:elseif={error}>
                <c-error-panel errors={error}></c-error-panel>
            </template>
        </div>

        <c-view-source source="lwc/apexImperativeMethod" slot="footer">
            Retrieve a list of records using an imperative Apex method call.
        </c-view-source>
    </lightning-card>
</template>
